p = list(it.permutations("0123456789"))
ps = sorted(p)
pss = map(lambda x:"".join(x), ps)
pss = sorted(pss)
pss[1000000-1]
